//不同密友圈的cookies标识
var getcookiesQid=function(){
	// var _cookiesQid=document.getElementById('qid').value;
	return ""
}


//公共方法
var buildUrl = function(type, module, method, params,fromcustomerId) {
		if(typeof(fromcustomerId)=="undefined")
		{
			var cus=document.getElementById('customerId').value;
		}
		else
		{
			var cus=fromcustomerId;
		}
	
		params = encodeURIComponent(JSON.stringify(params));
		var _URL = "call." + type + "?customerId=" + cus + '&module=' + module + '&method=' + method + '&params=' + params;
		return _URL;
	}

//iframe加载完成公共方法适应高度
function iframeLoad(_class){
	layer.closeAll();
	var height=document.documentElement.clientHeight,
		width=document.documentElement.clientWidth;
	console.log(document.getElementsByClassName(_class));
	document.getElementsByClassName(_class)[0].style.display='block';
	document.getElementsByClassName(_class)[0].style.width=width+'px';
	document.getElementsByClassName(_class)[0].style.height=height+'px';
}

//文档的总高度
function getScrollHeight() {
		var scrollHeight = 0,
			bodyScrollHeight = 0,
			documentScrollHeight = 0;
		if (document.body) {
			bodyScrollHeight = document.body.scrollHeight;
		}
		if (document.documentElement) {
			documentScrollHeight = document.documentElement.scrollHeight;
		}
		scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
		return scrollHeight;
	}

function getWindowHeight() {　　
		var windowHeight = 0;　　
		if (document.compatMode == "CSS1Compat") {　　　　
			windowHeight = document.documentElement.clientHeight;　　
		} else {　　　　
			windowHeight = document.body.clientHeight;　　
		}　　
		return windowHeight;
	}

function getScrollTop() {　　
	var scrollTop = 0,
		bodyScrollTop = 0,
		documentScrollTop = 0;　　
	if (document.body) {　　　　
		bodyScrollTop = document.body.scrollTop;　　
	}　　
	if (document.documentElement) {　　　　
		documentScrollTop = document.documentElement.scrollTop;　　
	}　　
	scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;　　
	return scrollTop;
}


function setCookie(name,value,time)
{ 
    var strsec = getsec(time); 
    var exp = new Date(); 
    exp.setTime(exp.getTime() + strsec*1); 
    document.cookie = getcookiesQid() + "-" + name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
} 
function getsec(str)
{ 
   var str1=str.substring(1,str.length)*1; 
   var str2=str.substring(0,1); 
   if (str2=="s")
   { 
        return str1*1000; 
   }
   else if (str2=="h")
   { 
       return str1*60*60*1000; 
   }
   else if (str2=="d")
   { 
       return str1*24*60*60*1000; 
   } 
} 

//读取cookies 
function getCookie(name) 
{ 
	name=getcookiesQid() + "-" + name;
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
 
    if(arr=document.cookie.match(reg))
 
        return unescape(arr[2]); 
    else 
        return null; 
} 

//删除cookies 
function delCookie(name) 
{ 
	name=getcookiesQid() + "-" + name;
    var exp = new Date(); 
    exp.setTime(exp.getTime() - 1); 
    var cval=getCookie(name); 
    if(cval!=null) 
        document.cookie= name + "="+cval+";expires="+exp.toGMTString(); 
} 

var bulselectlist='',
	bulselectstr='',
	exselectlist='',
	exselectstr='';

$(function(){
	if(getCookie('bulproduct')==null)
	{
		bulselectlist=["","",""]
	}
	else
	{
		bulselectlist=getCookie('bulproduct').split(',');
	}
	if(getCookie('extension')==null)
	{
		exselectlist=["",""]
	}
	else
	{
		exselectlist=getCookie('extension').split(',');
	}
	console.log(bulselectlist);
	console.log(exselectlist);
})


